package com.nolydake.swingnote.gui.renderer;

import java.awt.Component;

import javax.swing.JTree;
import javax.swing.tree.DefaultMutableTreeNode;
import javax.swing.tree.DefaultTreeCellRenderer;

import com.nolydake.swingnote.model.NoteForder;

public class MenuTreeCellRenderer extends DefaultTreeCellRenderer {

    /**
     * serialVersionUID
     */
    private static final long serialVersionUID = -8735389222305948360L;

    public Component getTreeCellRendererComponent(JTree tree, Object value, boolean selected, boolean expanded,
            boolean leaf, int row, boolean hasFocus) {

        super.getTreeCellRendererComponent(tree, value, selected, expanded, leaf, row, hasFocus);

        DefaultMutableTreeNode node = (DefaultMutableTreeNode) value;
        NoteForder forder = (NoteForder) node.getUserObject();

        if (forder == null) {
            return this;
        }

        this.setText(forder.name);

        // if (leaf && isTutorialBook(value)) {
        // setIcon(tutorialIcon);
        // setToolTipText("This book is in the Tutorial series.");
        // } else {
        // setToolTipText(null); // no tool tip
        // }

        return this;
    }
}
